﻿using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;

public class UIChangedList : MonoBehaviour 
{
	static string changedListPath = Application.dataPath + "/GameResources/UI/changedList.xml";
	static List<string> changedList = new List<string>();
	
	public static void Clean()
	{
		changedList.Clear();
	}
	
	public static void Add(string file)
	{
		if(!changedList.Contains(file))
			changedList.Add(file);
	}
	
	public static void Save()
	{
		XML<string>.SaveListAtPath(changedList, changedListPath);
	}
	
	[MenuItem("Tools/AssetsBundles/Build ChangedList")]
	public static void Build()
	{
		List<string> buildList = XML<string>.LoadListFromPath(changedListPath);
		foreach(string file in buildList)
			ExportAssetBundles.BuildFile(file);
	}
}
